package com.pan.entity;

import java.util.function.Function;

public class PosNameMapper<T> {

    //列的位置
    private int position;
    //该列映射类的属性名
    private String name;
    //转换方法
    private Function<String,T> mapper;
    //逆向转换方法
    private Function<T,String> reverseMapper;


    public PosNameMapper(int position, String name, Function<String, T> mapper, Function<T, String> reverseMapper) {
        this.position = position;
        this.name = name;
        this.mapper = mapper;
        this.reverseMapper = reverseMapper;
    }
    public PosNameMapper(int position, String name, Function<String, T> mapper) {
        this(position,name,mapper,null);
    }
    public PosNameMapper(int position, String name) {
        this(position,name,null,null);
    }




    public Function<T, String> getReverseMapper() {
        return reverseMapper;
    }

    public void setReverseMapper(Function<T, String> reverseMapper) {
        this.reverseMapper = reverseMapper;
    }
    public int getPosition() {
        return position;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Function<String, T> getMapper() {
        return mapper;
    }

    public void setMapper(Function<String, T> mapper) {
        this.mapper = mapper;
    }

    @Override
    public String toString() {
        return "PosNameMapper{" +
                "position=" + position +
                ", name='" + name + '\'' +
                ", mapper=" + mapper +
                '}';
    }
}
